﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<#include "/pages/include/include.ftl" />
<@h.css href="/css/uc.css"/>
<@h.css href="/css/upload.css"/>
<@h.js src="/javascripts/public/news.js"/>
<@h.js src="/javascripts/public/myfile.js"/>
<@h.js src="/ckeditor/ckeditor.js"/>
<#include "/pages/include/setlayout.ftl" />
<script type="text/javascript">
	var news=new news();
	var file=new myfile();
	$(function(){
		$('#choose').click(function(){
			news.chooseCate();
		});
		$('#uploadFile').click(function(){
			file.uploadNewsFile('${tempFileId?if_exists}');
		});
		$('#uploadImage').click(function(){
			file.uploadIcon('${tempImageId?if_exists}');
		});
		$('#ckbAllArea').click(function(){
			news.SelectAllArea($(this));
		});
		loadAttach();
		loadIcon();
	});
		
	function submit(){
		var form=$('#saveform');
		var legal =form.validate();
		if(legal){
			form.submit();
		}
		return;
	}
	
	function loadAttach(){
		$('#attachContainer').load('${contextPath}/myfile/myfile-loadNewsTempAttach.action?tempFileId=${tempFileId?if_exists}');
	}
	
	function loadIcon(){
		$('#imageContainer').load('${contextPath}/myfile/myfile-loadTempIcon.action?tempFileId=${tempImageId?if_exists}');
	}
	
	function delAttach(id){
		$('#attachContainer').load('${contextPath}/myfile/myfile-delNewsTempAttach.action?tempFileId=${tempFileId?if_exists}&attachId='+id);
	}
	
	function delIcon(id){
		$('#imageContainer').load('${contextPath}/myfile/myfile-delTempImage.action?tempFileId=${tempImageId?if_exists}&attachId='+id);
	}
	
	function loadImage(guid){
		$('#ic'+guid).load('${contextPath}/myfile/myfile-loadTempImage.action?tempFileId='+guid,function(){
			if($('#ic'+guid).html()!=""){
				$('#up'+guid).hide();
			}else{
				$('#up'+guid).show();
			}
		});
	}
	function delImage(id,guid){
		$('#ic'+guid).load('${contextPath}/myfile/myfile-delTempImage.action?tempFileId='+guid+'&attachId='+id,function(){
			if($('#ic'+guid).html()!=""){
				$('#up'+guid).hide();
			}else{
				$('#up'+guid).show();
			}
		});
		
	}
	
</script>
<style>
  .l-table-edit {}

  .l-table-edit-td{ padding:4px;}

    
 .l-table-edit-th {
	font-size: 14px;
	font-weight: bold;
	height: 25px;
	line-height: 25px;
	width: 45px;
} 
</style>
</head>

<body>
<#assign menuId="news">
<div id="layout1" class="wrapper">
	<#include "/pages/person/myfile/file_menu.ftl" />
	<div position="center" id="cent" title="编辑资讯" align="left" style="padding:0px 0px;overflow:auto;">
		<form id="saveform" action="${contextPath}/news/news-edit.action" method="post" >
		<@s.hidden id="tempFileId" name="tempFileId" value="${tempFileId?if_exists}"/>
		<@s.hidden id="tempImageId" name="tempImageId" value="${tempImageId?if_exists}"/>
		<@s.hidden name="n.id" value="${n.id?if_exists}"/>
		<@s.hidden name="lastRefer" value="${lastRefer?if_exists}"/>
        <table cellpadding="0" cellspacing="0" class="l-table-edit" width="100%">
            <tr>
                <td align="right" class="l-table-edit-th">标题<span style="color:red">*</span>:</td>
                <td align="left" class="l-table-edit-td" >
                	<input type="text" class="inputText required" value="${n.title?if_exists}" id="filename" name="n.title" maxlength="100" ltype="text" style="width:655px;"/>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-th" valign="top">分类:</td>
                <td align="left" class="l-table-edit-td">
                	<span id="cateinput" style="margin-right:30px;">${n.category?if_exists}</span>
                    <@s.hidden id="cateinputHidden" name="n.category" value="${n.category?if_exists}"/>
                    <@s.hidden id="cateIdHidden" name="n.categoryId" value="${n.categoryId?if_exists}"/>
					<a id="choose" class="minibutton" style="width:70px;"><span>修改分类</span></a>
				</td>
            </tr>  
            <tr>
                <td align="right" class="l-table-edit-th">显示位置:</td>
                <td align="left" class="l-table-edit-td">
                	<#if areas?exists>
                		<#list areas as area>
                			<input type="checkbox" class="inputCheckbox ckbArea" name="areas[${area_index}].id" value="${area.id?if_exists}" 
                				<#if n.areas?exists>
                					<#list n.areas as s>
                						<#if s.id==area.id>
                							checked="checked"
                						</#if>
                					</#list>
                				</#if>
                				
                			> ${area.name?if_exists}
                		</#list>
                	</#if>
                	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" class="inputCheckbox" id="ckbAllArea" > 全选
                </td>
            </tr>  
            <tr>
                <td align="right" class="l-table-edit-th" valign="top">简介:</td>
                <td align="left" class="l-table-edit-td">
                    <textarea id="all-summary" name="n.desc" maxlength="1000" cols="100" rows="5" class="l-textarea" style="width:660px">${n.desc?if_exists}</textarea>
                </td>      
            </tr>  
 			<tr>
                <td align="right" class="l-table-edit-th">关键词:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text" class="inputText" value="${n.keyword?if_exists}" id="all-keyword" name="n.keyword" maxlength="100" ltype="text" style="width:655px;"/>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-th">贡献者:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text" class="inputText" id="publishUserName" name="n.publishUserName" maxlength="100" ltype="text" value="${n.publishUserName?if_exists}"/>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-th" valign="top">图片:</td>
                <td align="left" class="l-table-edit-td">
                	<div >
						<a id="uploadImage" class="minibutton" style="width:70px;"><span>添加图片</span></a>
					</div>
					<div style="clear:both;height:10px;"></div>
                	<div id="imageContainer" style="width:660px;">

					</div>
                </td>
            </tr>
            <tr>
            	
                <td align="right" class="l-table-edit-th" valign="top">内容:</td>
                <td align="left" class="l-table-edit-td">
                	<div style="float:left;width:766px;">
                	<textarea id="editor" name="content" >
                    	<#list n.content as c>
                    		${c.content}
                    	</#list>
                    </textarea> 
                	</div>
                     
                </td> 
            </tr> 
            <tr>
                <td align="right" class="l-table-edit-th" valign="top"></td>
                <td align="left" class="l-table-edit-th">
                    <input type="checkbox" class="inputCheckbox" name="n.canFaqStr" 
                    	<#if n.canFaq>
                    		checked="checked"
                    	</#if>
                    	> 是否可评论
                    <input type="checkbox" class="inputCheckbox" name="n.canDownStr" 
                    	<#if n.canDown>
                    		checked="checked"
                    	</#if>
                    	> 是否可下载
                </td>      
            </tr> 
            <tr>
                <td align="right" class="l-table-edit-th">附件位置:</td>
                <td align="left" class="l-table-edit-td">
                	下方:<input class="inputCheckbox" type="radio" name="n.attachPosition" value="1" <#if n.attachPosition?exists && n.attachPosition==1> checked="checked"</#if> />
                	右方:<input class="inputCheckbox" type="radio" name="n.attachPosition" value="2" <#if n.attachPosition?exists && n.attachPosition==2> checked="checked"</#if> />
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-th" valign="top">附件:</td>
                <td align="left" class="l-table-edit-td">
                	<div >
						<a id="uploadFile" class="minibutton" style="width:70px;"><span>添加附件</span></a>
					</div>
					<div style="clear:both;height:10px;"></div>
					<div id="attachContainer">
					</div>
                </td>
            </tr>
        </table>

 <br />
<div style="width:766px;" align="center">
				<a href="javascript:submit();" class="minibutton"><span>提交</span></a>
			</div>
    </form>
		
	<br>
	<br>
	<br>
	</div>
	<#include "/pages/include/top.ftl" />
	
	
	<#include "/pages/include/bottom.ftl" />
</div>
 <script type="text/javascript">
					 CKEDITOR.replace('editor'); 
					
				</script>
</body>

</html>
